package com.dzq.shiro.controller;


import javax.servlet.http.HttpSession;

//@Controller
public class LoginController {
//    @RequestMapping("/login")
//    public ModelAndView login() {
//
//        ModelAndView mv = new ModelAndView("index"); return mv;
////        return "login";
//    }
//    @RequestMapping("/loginUser")
//    public String loginUser(String username,String password,HttpSession session) {
//        UsernamePasswordToken usernamePasswordToken=new UsernamePasswordToken(username,password);
//        Subject subject = SecurityUtils.getSubject();
//        try {
//            subject.login(usernamePasswordToken);   //完成登录
//            User user=(User) subject.getPrincipal();
//            session.setAttribute("user", user);
//            return "index";
//        } catch(Exception e) {
//            return "login";//返回登录页面
//        }
//
//    }
//    @RequestMapping("/logOut")
//    public String logOut(HttpSession session) {
//        Subject subject = SecurityUtils.getSubject();
//        subject.logout();
////        session.removeAttribute("user");
//        return "login";
//    }
}
